package tr.edu.metu.is.mega.client.service;

import java.util.List;

import tr.edu.metu.is.mega.common.dto.CourseDTO;
import tr.edu.metu.is.mega.common.dto.LectureNoteDTO;
import tr.edu.metu.is.mega.common.dto.TeamDTO;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * Gwt team service.
 */
@RemoteServiceRelativePath("../GwtTeamService")
public interface GwtTeamService extends RemoteService {

    /**
     * Utility class for simplifying access to the instance of async service.
     */
    public static class Util {

        private static GwtTeamServiceAsync instance;

        public static GwtTeamServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(GwtTeamService.class);
            }
            return instance;
        }
    }

    /**
     * Creates team record.
     * 
     * @param team team instance
     * @return created team instance
     */
    TeamDTO createTeam(TeamDTO team);

    /**
     * Updates team record.
     * 
     * @param team team instance
     * @return updated team instance
     */
    TeamDTO updateTeam(TeamDTO team);

    /**
     * Deletes team record
     * 
     * @param team to be deleted
     */
    void deleteTeam(TeamDTO team);

    /**
     * Returns list of teams in a course.
     * 
     * @param course course
     * @return list of teams
     */
    public List<LectureNoteDTO> getTeams(CourseDTO course);
}
